include ../Makefile.shared

define PROJ_mscore
  SOURCES = mscore.ml 
  RESULT = mscore
  LIBS=ext str data expat mn bn circuit pll
endef
export PROJ_mscore

define PROJ_bnsample
  SOURCES = bnsample.ml 
  RESULT = bnsample
endef
export PROJ_bnsample

define PROJ_mconvert
  SOURCES = mconvert.ml 
  RESULT = mconvert
endef
export PROJ_mconvert

define PROJ_fstats
  SOURCES = fstats.ml 
  RESULT = fstats
endef
export PROJ_fstats

define PROJ_rand
  SOURCES = rand.ml 
  RESULT = rand
endef
export PROJ_rand

define PROJ_spn2ac
  SOURCES = spn2ac.ml 
  RESULT = spn2ac
  LIBS= str unix ext data mn bn circuit
endef
export PROJ_spn2ac


# If the environment does not define subprojects to handle,
# then set a default
ifndef SUBPROJS
  export SUBPROJS = mscore bnsample mconvert fstats spn2ac rand
endif

export CLIBS=pll_stubs
export LIBS=ext str data expat mn bn pll circuit

# Default target to use
all: nc
	cp $(SUBPROJS) $(BINDIR)

# Catch-all target will be applied to all subprojects automatically
%:
	@$(MAKE) -f $(OCAMLMAKEFILE) subprojs SUBTARGET=$@
